package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.Customer;
import com.hzdl.car.mapper.CustomerMapper;
import com.hzdl.car.service.CustomerService;
import com.hzdl.car.vo.BaseBean;
import com.hzdl.car.vo.CustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceimpl implements CustomerService {
    @Autowired
    private CustomerMapper mapper;
    @Override
    public PageInfo<Customer> findWhere(CustomerVo customerVo) {
        PageHelper.startPage(customerVo.getPage(),customerVo.getLimit());
        List<Customer> list = mapper.findWhere(customerVo);
        return new PageInfo<>(list);
    }

    @Override
    public int add(CustomerVo customerVo) {
        return mapper.add(customerVo);
    }

    @Override
    public int update(CustomerVo customerVo) {
        return mapper.update(customerVo);
    }

    @Override
    public int delete(String identity) {
        return mapper.delete(identity);
    }

    @Override
    public List<BaseBean> findAddress() {
        return mapper.findAddress();
    }

    @Override
    public List<Customer> findAll(CustomerVo customerVo) {
        return mapper.findWhere(customerVo);
    }
}
